package com.blackhorse.servlet;

import java.io.File;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(value = "/initServlet", loadOnStartup = 1)
public class InitServlet extends HttpServlet {
	@Override
	public void init() throws ServletException {
		String path = this.getServletContext().getRealPath("/upload");
		System.out.println(path);
		File file = new File(path);
		if (!file.exists()) {
			file.mkdirs();// 如果不存在，创建文件夹
		}
	}
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
	}
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
	}
	
	@Override
	protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	}

}
